'''
This file is part of ModeliMark.

ModeliMark is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

ModeliMark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with ModeliMark.
If not, see <http://www.gnu.org/licenses/>.

Copyright 2012 Jens Frenkel
'''

import os
import modelimark

import win32api,win32process,win32con
pid = win32api.GetCurrentProcessId()
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
win32process.SetPriorityClass(handle, win32process.BELOW_NORMAL_PRIORITY_CLASS)


# get compiler phat
OPENMODELICAHOME = os.environ.get('OPENMODELICAHOME')
omcpath = '%s/bin/omc.exe'%(OPENMODELICAHOME)

print omcpath

# generate range
numbers = []
k = 10
for i in xrange(10):
    numbers.append(k)
    k = k*2

task = 'flatclass_omc'
print task
# workdir
workdir = '%s/%s'%(modelimark.settings.globalworkdir,task)

# model
model = modelimark.FlatClass()
compiler = modelimark.OMC(omcpath)
bench = modelimark.BenchmarkComponent()
bench.runBenchmark(compiler, model, workdir, '%s.csv'%(task), numbers)


